Kanzi 3.9.10
kanzi::Timeline Class Referenceabstract

The Kanzi animation system consists of animations and timelines: animations define how the values of specific type change in time, and timelines map the animations to properties of objects you want to animate. More...

#include <kanzi/core.ui/animation/timeline.hpp>

Inheritance diagram for kanzi::Timeline:
[legend]

Public Types

enum  DirectionBehavior { DirectionBehaviorNormal , DirectionBehaviorReverse , DirectionBehaviorPingPong }
 Specifies the direction behavior for a timeline. More...
 
- Public Types inherited from kanzi::PropertyObject
typedef PropertyStorageContainer::const_iterator PropertyStorageConstIterator
 
typedef vector< PropertyStoragePtrPropertyStorageContainer
 
typedef PropertyStorageContainer::iterator PropertyStorageIterator
 
typedef intrusive_ptr< AbstractPropertyTypeDescriptor::PropertyStoragePropertyStoragePtr
 
typedef PropertyStorageContainer::reverse_iterator PropertyStorageReverseIterator
 

Public Member Functions

TimeInterval calculateClipInterval ()
 Calculates clip interval of timeline.
 
optional< chrono::milliseconds > calculateDuration ()
 Calculates the duration of the timeline.
 
unsigned int calculateIterationCount ()
 Calculates number of iterations in timeline.
 
optional< chrono::milliseconds > calculateIterationDuration ()
 Calculates iteration duration.
 
TimelinePlaybackSharedPtr createPlayback (TimelinePlaybackContext &context)
 Creates playback for timeline.
 
optional< chrono::milliseconds > getClipDuration () const
 Gets the clip duration of the timeline (in milliseconds).
 
chrono::milliseconds getClipStartTime () const
 Gets the clip start time of the timeline (in milliseconds).
 
DirectionBehavior getDirectionBehavior () const
 Gets the direction behavior of a timeline.
 
float getDurationScale () const
 Gets the duration scale of timeline.
 
float getMinimumDurationScale () const
 Gets minimum duration scale.
 
unsigned int getRepeatCount () const
 Gets the repeat count of the timeline (zero indicates infinite repeats).
 
chrono::milliseconds getStartTime () const
 Gets the start time of the timeline (in milliseconds).
 
void setClipDuration (optional< chrono::milliseconds > duration)
 Sets the clip duration of the timeline (in milliseconds).
 
void setClipStartTime (chrono::milliseconds clipStartTime)
 Sets the clip start time of the timeline (in milliseconds).
 
void setDirectionBehavior (DirectionBehavior directionBehavior)
 Sets the direction behavior of a timeline.
 
void setDurationScale (float scale)
 Sets the duration scale of timeline.
 
void setRepeatCount (unsigned int repeatCount)
 Sets the repeat count of the timeline (zero indicates infinite repeats).
 
void setStartTime (chrono::milliseconds startTime)
 Gets the start time of the timeline (in milliseconds).
 
- Public Member Functions inherited from kanzi::Object
AppliedStyleEntrySharedPtr applyObjectStyle (kanzi::StyleSharedPtr style)
 Applies a style to an object.
 
void applyObjectStyles ()
 Apply all styles for an object node.
 
DomaingetDomain () const
 Returns the domain the object belongs to.
 
const MetaclassgetDynamicMetaclass () const override
 Returns the metaclass of the dynamic type of the object.
 
MainLoopSchedulergetMainLoopScheduler () const
 Returns the MainLoopScheduler instance of the associated Domain.
 
detail::MessageDispatcher * getMessageDispatcher () const
 Returns the message dispatcher of the object.
 
ResourceManagergetResourceManager () const
 Returns the resource manager of the object.
 
ScriptingContextSharedPtr getScriptingContext () const
 Gets the scripting context of the object.
 
 Object (Domain *domain)
 
void setScriptingContext (ScriptingContextSharedPtr context)
 Sets the scripting context of the object.
 
void unapplyObjectStyle (AppliedStyleEntrySharedPtr appliedStyleEntry)
 
void unapplyObjectStyles ()
 Unapplies and removes all applied styles.
 
 ~Object () override
 
- Public Member Functions inherited from kanzi::MetaObject
bool isTypeOf (const Metaclass *objectType) const
 Determines if the type of this object is the given type or derived from it.
 
virtual ~MetaObject ()
 
- Public Member Functions inherited from kanzi::PropertyObject
template<typename DataType >
void addPropertyModifier (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::ModifierCallback callback, void *owner)
 
template<typename DataType >
void addPropertyModifierWithoutNotifyingHandlers (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::ModifierCallback callback, void *owner)
 Adds a property modifier without notifying handlers.
 
template<typename DataType >
void addPropertyNotificationHandler (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::NotificationCallback callback, void *owner)
 
template<typename DataType >
void addPropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, PropertyValuePrecedence precedence, AbstractPropertyTypeDescriptor::ValueSourceOwner *owner)
 
template<typename DataType >
void addPropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, PropertyValuePrecedence precedence, void *ownerPointer)
 
PropertyStorageContainer::iterator beginPropertyStorage ()
 Returns the begin iterator to the internal property storage container.
 
PropertyStorageContainer::const_iterator beginPropertyStorage () const
 Returns the begin iterator to the internal property storage container.
 
void clearPropertyFlag (AbstractPropertyType propertyType, uint32_t flag)
 
void copyLocalValue (const PropertyObject &other, AbstractPropertyType propertyType)
 Copies local value of single property from another object.
 
void copyLocalValues (const PropertyObject &other)
 Copies all local values from another object.
 
PropertyStorageContainer::iterator endPropertyStorage ()
 Returns the end iterator to the internal property storage container.
 
PropertyStorageContainer::const_iterator endPropertyStorage () const
 Returns the end iterator to the internal property storage container.
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getAbstractProperty (AbstractPropertyType abstractPropertyType) const
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getAbstractPropertyBase (AbstractPropertyType abstractPropertyType) const
 
template<typename DataType >
optional< typename PropertyType< DataType >::Traits::ReturnType > getOptionalAbstractProperty (AbstractPropertyType abstractPropertyType) const
 
template<typename DataType >
optional< typename PropertyType< DataType >::Traits::ReturnType > getOptionalProperty (const PropertyType< DataType > &propertyType) const
 Evaluates the property value in the same way as the overload above but does not default to the value in property metadata if there are no inputs to the property value.
 
template<typename DataType >
optional< typename PropertyType< DataType >::Traits::ReturnType > getOptionalPropertyBase (const PropertyType< DataType > &propertyType) const
 Returns the current value of a property disregarding modifiers, but does not default to the value in property metadata if there are no inputs to the property value.
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getProperty (const PropertyType< DataType > &propertyType) const
 Returns the current value of a property type.
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getPropertyBase (const PropertyType< DataType > &propertyType) const
 Returns the current value of a property disregarding modifiers.
 
template<typename DataType >
size_t getPropertyNotificationHandlerCount (const PropertyType< DataType > &propertyType) const
 Gets number of current notification handlers for given property type.
 
bool hasBaseValue (AbstractPropertyType propertyType) const
 Evaluates whether there are any inputs into the property value, disregarding modifiers.
 
bool hasLocalValue (AbstractPropertyType propertyType) const
 Evaluates whether there is a local value set for the property.
 
bool hasNonClassValue (AbstractPropertyType propertyType) const
 Evaluates whether there is a value of any precedence higher than class default value set for the property.
 
bool hasValue (AbstractPropertyType propertyType) const
 Evaluates whether there are any inputs into the property value.
 
bool isPropertyFlagSet (AbstractPropertyType propertyType, uint32_t flag) const
 
virtual void onPropertyChanged (AbstractPropertyType propertyType, PropertyNotificationReason reason)
 Virtual function to handle property change notifications.
 
 PropertyObject ()
 
void removeKzbProperties ()
 Remove all KZB properties.
 
void removeKzbProperties (flat_set< AbstractPropertyType > *keepProperties)
 Remove all KZB properties that are not included in a given set.
 
template<typename DataType >
void removeLocalPropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, void *ownerPointer)
 
void removeLocalValue (AbstractPropertyType propertyType)
 Removes the local value associated with the property.
 
template<typename DataType >
void removePropertyModifier (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::ModifierCallback callback, void *owner)
 
template<typename DataType >
void removePropertyNotificationHandler (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::NotificationCallback callback, void *owner)
 
template<typename DataType >
void removePropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, void *ownerPointer)
 
template<typename DataType >
void setAbstractProperty (AbstractPropertyType abstractPropertyType, typename PropertyType< DataType >::Traits::ParameterType value)
 
template<typename DataType >
void setProperty (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Traits::ParameterType value)
 Sets the local value of a property type.
 
void setPropertyFlag (AbstractPropertyType propertyType, uint32_t flag)
 
KZ_DEPRECATED void validatePropertyModifiers (AbstractPropertyType propertyType)
 Validates property modifiers and notifies handlers.
 
void validatePropertyModifiersAndNotifyHandlers (AbstractPropertyType propertyType)
 Validates property modifiers and notifies handlers.
 
virtual ~PropertyObject ()
 

Protected Member Functions

virtual optional< chrono::milliseconds > calculateContentDuration ()
 Calculates the duration of the content of the timeline.
 
virtual TimelinePlaybackSharedPtr createPlaybackOverride (TimelinePlaybackContext &context)=0
 Creates playback of the timeline.
 
virtual void loadOverride (Domain *domain, string_view name, KzbFile &kzbFile, KzbMemoryParser &parser)
 Loads timeline data from KZB.
 
 Timeline (Domain *domain)
 Constructor.
 
- Protected Member Functions inherited from kanzi::Object
void initialize ()
 
void onCopy (const Object &other)
 
- Protected Member Functions inherited from kanzi::MetaObject
void initialize ()
 
 MetaObject ()
 
- Protected Member Functions inherited from kanzi::PropertyObject
AbstractPropertyTypeDescriptor::ValueSourceEntryacquireLocalValueSourceEntry (AbstractPropertyTypeDescriptor &descriptor, PropertyStoragePtr &propertyStorage)
 Acquires a local value source entry that is free for the assignment of a value.
 
AbstractPropertyTypeDescriptor::ModifierStorageacquireModifierStorage (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::PropertyStorage &propertyStorage)
 
AbstractPropertyTypeDescriptor::NotificationStorageacquireNotificationStorage (AbstractPropertyTypeDescriptor &descriptor)
 
PropertyStoragePtr acquirePropertyStorage (AbstractPropertyTypeDescriptor &descriptor)
 
template<typename DataType >
void addPropertyModifierBase (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::ModifierCallback callback, void *owner, bool notify)
 Adds a property modifier entry to the property modifier stack and validates them.
 
void addPropertyValueSource (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::ValueSource *valueSource, PropertyValuePrecedence precedence, AbstractPropertyTypeDescriptor::ValueSourceOwner *owner)
 Internally adds a property value source.
 
void addPropertyValueSource (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::ValueSource *valueSource, PropertyValuePrecedence precedence, void *ownerPointer)
 Internally adds a property value source.
 
AbstractPropertyTypeDescriptor::ValueSourceEntryconstructLocalValueSourceEntry (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::PropertyStorage &propertyStorage)
 
PropertyStoragePtr constructPropertyStorage (AbstractPropertyTypeDescriptor &descriptor)
 
void copyLocalValue (const AbstractPropertyTypeDescriptor::PropertyStorage &otherPropertyStorage)
 Copy local value from property storage.
 
AbstractPropertyTypeDescriptor::ModifierStoragefindModifierStorage (AbstractPropertyTypeDescriptor &descriptor)
 
AbstractPropertyTypeDescriptor::NotificationStoragefindNotificationStorage (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::PropertyStoragefindPropertyStorage (AbstractPropertyTypeDescriptor &descriptor) const
 Gets the property storage for given property type descriptor.
 
PropertyStoragePtr findPropertyStoragePtr (AbstractPropertyTypeDescriptor &descriptor) const
 Gets property storage intrusive pointer which you can use to hold a reference until the end of the operation.
 
AbstractPropertyTypeDescriptorfindPropertyTypeDescriptorByNameAndDataType (string_view name, PropertyDataType dataType) const
 Finds a property type descriptor by name and data type.
 
AbstractPropertyTypeDescriptorfindPropertyTypeDescriptorByQualifiedNameAndDataType (string_view qualifiedName, PropertyDataType dataType) const
 Like findPropertyTypeDescriptorByNameAndDataType, but only searches by matching with qualified names.
 
AbstractPropertyTypeDescriptorfindPropertyTypeDescriptorByUnqualifiedNameAndDataType (string_view unqualifiedName, PropertyDataType dataType) const
 Like findPropertyTypeDescriptorByNameAndDataType, but only searches by matching with unqualified names.
 
AbstractPropertyTypeDescriptor::ValueSourcegetClassValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::ValueSourcegetFinalValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::ValueSourcegetNonClassValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::ValueSourcegetTopValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 Gets the top-level value source for a given property descriptor.
 
virtual void notifyPropertyHandlers (PropertyStoragePtr &storagePtr, PropertyNotificationReason reason)
 Notifies all property handlers on a property storage.
 
void onCopy (const PropertyObject &other)
 
void removeLocalValue (AbstractPropertyTypeDescriptor &descriptor, PropertyStoragePtr &propertyStorage)
 Removes a local value from the given property storage.
 
void removePropertyValueSource (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::ValueSource *valueSource, void *owner)
 Removes a property value source.
 
void validatePropertyModifiers (PropertyStoragePtr &propertyStorage)
 Validates property modifiers without notifying handlers.
 
void validatePropertyModifiersAndNotifyHandlers (PropertyStoragePtr &propertyStorage)
 Validates property modifiers and notifies handlers.
 

Friends

class TimelinePlayback
 

Additional Inherited Members

- Static Public Member Functions inherited from kanzi::Object
static const MetaclassgetStaticMetaclass ()
 Returns the metaclass of Object class.
 
static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 Default implementation that returns empty editor info.
 
- Static Public Member Functions inherited from kanzi::MetaObject
static const MetaclassgetStaticMetaclass ()
 Returns the metaclass of Object class.
 
static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 Default implementation that returns empty editor info.
 
- Protected Types inherited from kanzi::Object
typedef vector< AppliedStyleEntrySharedPtrAppliedStyleContainer
 Applied style container.
 
- Protected Attributes inherited from kanzi::Object
AppliedStyleContainer m_appliedStyles
 Listing of applied styles applied to this object.
 

Detailed Description

The Kanzi animation system consists of animations and timelines: animations define how the values of specific type change in time, and timelines map the animations to properties of objects you want to animate.

The Timeline class defines common properties which specify how the playback of a timeline is performed. These properties include timeline start time, content clip start time and clip duration, repeat count and so on. Actual classes inherited from the Timeline class define how animations are applied to the properties of objects. For an example of actual classes see PropertyAnimationTimeline, PropertyFieldAnimationTimeline or ParallelTimeline.

Timeline is a series of iterations played successively starting from specified start time. Each iteration is a continuous portion of timeline content which is played in a specific manner. Timeline content can be a single animation (as in PropertyAnimationTimeline), several animations which are animating fields of a single property (as in PropertyFieldAnimationTimeline) or even other timelines (as in ParallelTimeline).

Start time

To specify the time at which the first iteration of a timeline starts to play, set the start time property of the timeline. Start time is defined in the time space of the clock where the playback of this timeline is added or in the time space of its parent playback. Start time can be positive or negative. Negative start time causes the timeline to act like it started at some time in the past. It can cause the timeline to start as if it was half-way finished. The default value for start time is 0 milliseconds.

To set the start time of Timeline call its setStartTime() function:

// Set start time of timeline to 100 milliseconds.
// Playback of timeline will start to perform its first iteration after its global time reaches 100 milliseconds.
timeline->setStartTime(chrono::milliseconds(100));

To retrieve the start time of Timeline call its getStartTime() function.

// Get start time of timeline.
chrono::milliseconds startTime = timeline->getStartTime();

Clip start time and clip duration

To specify the portion of timeline content played in an iteration set the clip start time and clip duration properties of the timeline. Clip start time and clip duration are defined in the time space of the timeline content. By default, the whole timeline content is played in a single iteration.

To set the clip start time and clip duration of Timeline call its setClipStartTime() and setClipDuration() functions:

// Set clip start time of timeline to 100 milliseconds.
// Playback of timeline will perform playback of timeline content starting from 100 milliseconds in each iteration.
timeline->setClipStartTime(chrono::milliseconds(100));
// Set clip duration of timeline to 200 milliseconds.
// Playback of timeline will perform playback of timeline content for 200 milliseconds in each iteration.
timeline->setClipDuration(chrono::milliseconds(200));

To retrieve the clip start time and clip duration of Timeline call its getClipStartTime() and getClipDuration() functions. Note that getClipDuration() can return empty optional, meaning that clip duration is not specified.

// Get clip start time of timeline.
chrono::milliseconds clipStartTime = timeline->getClipStartTime();
// Get clip duration of timeline.
optional<chrono::milliseconds> clipDuration = timeline->getClipDuration();

Duration scale

To scale the portion of timeline content played in an iteration up or down, set the duration scale property of the timeline. By default, the value of duration scale is 1 which means that timeline content is not scaled. If duration scale is larger than 1, timeline content is scaled up when it is played in an iteration. For example, if you set duration scale to 2, timeline content is played at half speed and the duration of the iteration is twice as long as normally. If duration scale is less than 1, timeline content is scaled down when it is played. For example, if you set duration scale to 0.5, timeline content is played twice as fast as normally and iteration duration is half of the normal. Timeline duration scale cannot be negative or zero. If you set the duration scale to such a value, the timeline will clamp it to the minimum allowed scale value. Timeline duration scale does not affect the start time of the timeline.

To set the duration scale of Timeline call its setDurationScale() function:

// Set scale of timeline to 4.
// Playback of timeline will be 4 times slower compared to default playback speed and each iteration
// will be 4 times longer compared to iteration duration with default scale.
timeline->setDurationScale(4.0f);

To retrieve the duration scale of Timeline call its getDurationScale() function.

// Get duration scale of timeline.
float durationScale = timeline->getDurationScale();

Direction behavior

Timeline content in an iteration can be played in either normal or reverse direction. By default (or if you set the direction behavior property of the timeline to Timeline::DirectionBehaviorNormal) the content is played in normal direction. If you set the direction behavior property of the timeline to Timeline::DirectionBehaviorReverse, each iteration plays its portion of timeline content in reverse manner, that is, from the end to the beginning of the content portion. If you set direction behavior to Timeline::DirectionBehaviorPingPong, then each odd iteration plays its content normally and each even iteration plays its content in reverse manner.

To set the direction behavior of Timeline to one of the values from Timeline::DirectionBehavior call Timeline's setDirectionBehavior() function:

// Set direction behavior of timeline to pingpong.
// Each odd iteration of timeline will play its content normally
// and each even iteration will play it in reverse manner.
timeline->setDirectionBehavior(Timeline::DirectionBehaviorPingPong);

To retrieve the direction behavior of Timeline call its getDirectionBehavior() function.

// Get direction behavior of timeline.
enum Timeline::DirectionBehavior directionBehavior = timeline->getDirectionBehavior();

Repeat count

The number of iterations in a timeline is affected by several properties of the timeline. In general, to define how many iterations should be played in a timeline set its repeat count property. But if the direction behavior of the timeline is set to Timeline::DirectionBehaviorPingPong, then each iteration has two sub-iterations (the first sub-iteration plays its portion of the timeline content in normal direction and the second one plays it in reverse direction), so the number of iterations defined by repeat count is doubled. For example, if you set repeat count to 10 and direction behavior to Timeline::DirectionBehaviorPingPong, the number of iterations in the timeline becomes 20. If you set repeat count to 0, the number of iterations in timeline becomes infinite.

To set the repeat count of Timeline call its setRepeatCount() function:

// Set repeat count of Timeline to 10.
// Playback of timeline will perform 10 iterations of timeline content.
timeline->setRepeatCount(10);
// Set repeat count of Timeline to 0.
// Playback of timeline will perform infinite amount of iterations.
timeline->setRepeatCount(0);

To retrieve the repeat count of Timeline call its getRepeatCount() function.

// Get repeat count of timeline.
unsigned int repeatCount = timeline->getRepeatCount();

Timeline playback

To perform playback of Timeline, create a TimelinePlayback object by calling the createPlayback() function of Timeline. After that you add playback to a TimelineClock by calling its TimelineClock::addTimelinePlayback() function. TimelineClock will advance the global time of the TimelinePlayback object which in turn will advance Timeline.

To start the playback of Timeline:

// Create playback context.
SceneGraphTimelinePlaybackContext context(*nodeToAnimate);
// Create playback for timeline.
TimelinePlaybackSharedPtr timelinePlayback = timeline->createPlayback(context);
// Add playback to the clock.
timelineClock->addTimelinePlayback(timelinePlayback);

Do not change the properties of a timeline after you have added its playback to a clock. Changing any timeline property after its playback is added to a clock will result in undefined behavior.

See also
ParallelTimeline
PropertyAnimationTimeline
PropertyFieldAnimationTimeline
TimelinePlayback
TimelineClock

Member Enumeration Documentation

◆ DirectionBehavior

Specifies the direction behavior for a timeline.

Enumerator
DirectionBehaviorNormal 

Normal forward direction behavior.

DirectionBehaviorReverse 

Reverse direction behavior. Animation starts from the end and progresses backwards. Not supported if duration is infinite.

DirectionBehaviorPingPong 

Animation first progresses forward, bounces from the end and then progresses backwards back to the beginning.

Constructor & Destructor Documentation

◆ Timeline()

kanzi::Timeline::Timeline ( Domain * domain)
explicitprotected

Constructor.

Parameters
domainDomain.

Member Function Documentation

◆ getStartTime()

chrono::milliseconds kanzi::Timeline::getStartTime ( ) const

Gets the start time of the timeline (in milliseconds).

Returns
Start time of timeline.

◆ setStartTime()

void kanzi::Timeline::setStartTime ( chrono::milliseconds startTime)

Gets the start time of the timeline (in milliseconds).

Parameters
startTimeStart time of timeline.

◆ getClipStartTime()

chrono::milliseconds kanzi::Timeline::getClipStartTime ( ) const

Gets the clip start time of the timeline (in milliseconds).

Returns
Clip start time of timeline.

◆ setClipStartTime()

void kanzi::Timeline::setClipStartTime ( chrono::milliseconds clipStartTime)

Sets the clip start time of the timeline (in milliseconds).

Parameters
clipStartTimeClip start time of timeline.

◆ getClipDuration()

optional< chrono::milliseconds > kanzi::Timeline::getClipDuration ( ) const

Gets the clip duration of the timeline (in milliseconds).

Returns
Clip duration of timeline.

◆ setClipDuration()

void kanzi::Timeline::setClipDuration ( optional< chrono::milliseconds > duration)

Sets the clip duration of the timeline (in milliseconds).

Parameters
durationClip duration of timeline.

◆ getRepeatCount()

unsigned int kanzi::Timeline::getRepeatCount ( ) const

Gets the repeat count of the timeline (zero indicates infinite repeats).

Returns
Repeat count of timeline.

◆ setRepeatCount()

void kanzi::Timeline::setRepeatCount ( unsigned int repeatCount)

Sets the repeat count of the timeline (zero indicates infinite repeats).

Parameters
repeatCountRepeat count of timeline.

◆ getDirectionBehavior()

DirectionBehavior kanzi::Timeline::getDirectionBehavior ( ) const

Gets the direction behavior of a timeline.

Returns
direction behavior of timeline.

◆ setDirectionBehavior()

void kanzi::Timeline::setDirectionBehavior ( DirectionBehavior directionBehavior)

Sets the direction behavior of a timeline.

Parameters
directionBehaviorDirection behavior of timeline.

◆ getDurationScale()

float kanzi::Timeline::getDurationScale ( ) const

Gets the duration scale of timeline.

Returns
Duration scale of timeline.

◆ setDurationScale()

void kanzi::Timeline::setDurationScale ( float scale)

Sets the duration scale of timeline.

If specified scale is smaller than minimum scale, the scale is clamped to minimum scale value.

Parameters
scaleDuration scale of timeline.

◆ getMinimumDurationScale()

float kanzi::Timeline::getMinimumDurationScale ( ) const

Gets minimum duration scale.

Returns
Minimum duration scale.

◆ calculateClipInterval()

TimeInterval kanzi::Timeline::calculateClipInterval ( )

Calculates clip interval of timeline.

This content interval will be played by each iteration of timeline during its playback. Clip interval is calculated by applying clip start time and clip duration to content duration of timeline.

Returns
Content interval.

◆ calculateIterationCount()

unsigned int kanzi::Timeline::calculateIterationCount ( )

Calculates number of iterations in timeline.

Number of iteration is calculated from repeat count of timeline and its direction behavior.

Returns
Number of iterations.

◆ calculateIterationDuration()

optional< chrono::milliseconds > kanzi::Timeline::calculateIterationDuration ( )

Calculates iteration duration.

Iteration duration is calculated by applying duration scale to duration of clipped content interval.

Returns
Number of iterations.

◆ calculateDuration()

optional< chrono::milliseconds > kanzi::Timeline::calculateDuration ( )

Calculates the duration of the timeline.

Timeline duration calculated as a iteration duration multiplied by iteration count. Timeline start time does not affect timeline duration. Returns nullopt if the duration of timeline is infinite.

Returns
Duration of timeline.

◆ createPlayback()

TimelinePlaybackSharedPtr kanzi::Timeline::createPlayback ( TimelinePlaybackContext & context)

Creates playback for timeline.

Parameters
contextContext for playback.
Returns
Timeline playback object.

◆ createPlaybackOverride()

virtual TimelinePlaybackSharedPtr kanzi::Timeline::createPlaybackOverride ( TimelinePlaybackContext & context)
protectedpure virtual

◆ calculateContentDuration()

virtual optional< chrono::milliseconds > kanzi::Timeline::calculateContentDuration ( )
protectedvirtual

Calculates the duration of the content of the timeline.

No timeline playback properties (e.g. start time, clip start time and duration, repeat count, etc) should be used when calculating content duration. By default content duration of timeline is zero milliseconds (empty timeline).

Returns
Duration of timeline content.

Reimplemented in kanzi::ValueAccumulatorTimeline< TAccumulatedValue >, kanzi::MorphWeightTimeline, kanzi::ParallelTimeline, kanzi::PreviewTimeline, kanzi::PropertyAnimationTimeline, kanzi::PropertyFieldAnimationTimeline, kanzi::PropertyTargetEasingTimeline, and kanzi::PropertyTargetInterpolationTimeline.

◆ loadOverride()

virtual void kanzi::Timeline::loadOverride ( Domain * domain,
string_view name,
KzbFile & kzbFile,
KzbMemoryParser & parser )
protectedvirtual

Loads timeline data from KZB.

Subclasses of Timeline class can override this function to load type-specific timeline data. In this case override function should call loadOverride() of Timeline class before loading type-specific data.

Parameters
domainDomain.
nameTimeline name.
kzbFileKZB file to load timeline data from.
parserParser to parse timeline data.

Reimplemented in kanzi::MorphWeightTimeline, kanzi::ParallelTimeline, kanzi::PropertyAnimationTimeline, and kanzi::PropertyFieldAnimationTimeline.

Friends And Related Symbol Documentation

◆ TimelinePlayback


The documentation for this class was generated from the following file: